<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 小夏 < 449134904@qq.com>
// +----------------------------------------------------------------------
namespace api\home\validate;

use think\Validate;

class DeviceValidate extends Validate
{
    protected $rule = [
        'title'        =>  'require|unique:device',
	    'descirption'      =>  'require',
	    'price'        =>  'require',
        'type_one'        =>  'require',
        'type_two'        =>  'require',
        'code'        =>  'require',
        'is_resale'        =>  'require'
    ];
    protected $message = [
        'title.require'    =>  '设备标题不能为空',
        'title.unique'      =>'该设备已存在',
	    'descirption.require'  =>  '设备内容不能为空',
	    'price.require'    =>  '价格不能为空',
        'type_one.require'    =>  '设备类型不能为空',
        'type_two.require'    =>  '设备类型不能为空',
        'code.require'    =>  '编号不能为空',
        'is_resale.require'    =>  '请选择是否转售'
    ];

    protected $scene = [
        'add'  => [ 'title' , 'descirption' , 'price'  , 'type_one'  , 'type_two'  , 'code'  , 'is_resale'],
        'edit' => [ 'title' , 'descirption' , 'price'  , 'type_one'  , 'type_two'  , 'code'  , 'is_resale']
    ];
}